package mgorm

type DocConfig struct {
	Doc             Doc
	ContainerKey    string //注册到容器中的key
	GetFactory      func() Factory
	Fields          []string                   //字段列表
	RelationFields  []string                   //字段列表
	RelationConfigs map[string]*DocRelation    //关联关系
	FieldFilter     map[string]*DocFieldFilter //字段过滤
	ExcelFields     map[string]*ExcelField     //导出字段
}

type DocRelation struct {
	Config       func() *DocConfig
	ContainerKey string ""
	DocName      string
	JoinType     string //M对多,O对单
	KeyInside    string
	KeyOutSide   string
	IsMirror     bool //是否是镜像，镜像模式下，数据被拷贝到关联表中，非镜像模式下，需要二次查询
}

type DocFieldFilter struct {
	Select []string
	Omit   []string
}

type ExcelField struct {
	Values []string
	Names  []string
}

var DocConfigContainer = make(map[string]*DocConfig)

func SetDocConfig(config *DocConfig) {
	DocConfigContainer[config.ContainerKey] = config
}

func GetDocConfig(containerKey string) *DocConfig {
	return DocConfigContainer[containerKey]
}
